cmake_minimum_required(VERSION 3.4)
project(engine)
#add_compile_options(-std=c++17)
#add_compile_options(-Werror)
#set(CMAKE_CXX_USE_PCH, ON)
#set(CMAKE_CXX_PRECOMPILED_HEADER_SOURCE, "src/hzpch.h")
#set(CMAKE_CXX_PRECOMPILED_HEADER_CONTENTS "// 预编译头文件内容")
set(CMAKE_CXX_STANDARD 17)

#定义宏
add_definitions(-DHZ_PLATFORM_WINDOWS=true)
add_definitions(-DHZ_BUILD_DLL)
add_definitions(-DWINDLL)
#设置输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
#设置中间目录
#add_subdirectory(${PROJECT_SOURCE_DIR}/game)

file(GLOB_RECURSE SRC_DIR_LIST "src/*.cpp")
add_library(engine SHARED ${SRC_DIR_LIST})
#添加GLFW
set(GLFW_DIR vendor/GLFW)
add_subdirectory(${GLFW_DIR} glfw_binary EXCLUDE_FROM_ALL)
#list(APPEND INCLUDE_DIR vendor/GLFW/include)
list(APPEND INCLUDE_DIR ${GLFW_DIR}/include)
list(APPEND INCLUDE_DIR ${GLFW_DIR}/deps)

list(APPEND LINK_LIBS glfw)

#w外部库
target_include_directories(${PROJECT_NAME} PUBLIC
        vendor/spdlog/include
        vendor/GLFW/include
        src/Hazel/Events
        ${INCLUDE_DIR}

)
target_link_libraries(engine PUBLIC ${LINK_LIBS})


#target_link_libraries(engine glfw)
#link_directories()
#设置预编译头
target_precompile_headers(engine PRIVATE src/hzpch.h)
#include_directories(${PROJECT_SOURCE_DIR}"/src/Hazel/Events")
#add_library(engine SHARED src/Hazel/Application.cpp)
#使用 GLOB 自动查找当前目录下指定扩展名的文件，实现批量添加源文件：
message("SRC_DIR_LIST = ${SRC_DIR_LIST}")
add_subdirectory(game)
#SET_TARGET_PROPERTIES(engine PROPERTIES  ${PROJECT_SOURCE_DIR} /bin/)
#message(“default build type is ${PROJECT_SOURCE_DIR}/bin/”)
#set(EXECUTABLE_OUTPUT_PATH   ${PROJECT_SOURCE_DIR}/bin)
#a

